//Source file: D:\\aaa\\com\\ce\\pms\\renovation\\model\\AbstractApprovalDO.java

package com.ce.pms.renovation.model;

import java.util.Date;

import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.ce.pms.common.model.HmEmployeeDomain;
import com.ce.pms.common.model.SysInfo;
import com.sitechasia.webx.core.model.IDomainObject;

/**
 * 实体名称:审批 关联数据表:RM_APPROVAL
 *
 * @author yandawei
 * @CreateDate:2008-12-17
 */
@Entity
@Table(name = "RM_APPROVAL")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "APPROVAL_TYPE", discriminatorType = DiscriminatorType.STRING)
public abstract class AbstractApprovalDO implements IDomainObject {

	/**
	 * 主键
	 */
	@Id
	@GeneratedValue
	@Column(name = "APPROVAL_ID")
	private Long keyword;

	/**
	 * 审批结果 001-通过，002不通过
	 */
	@Column(name = "RESULT", length = 3)
	private String result;

	/**
	 * 备注
	 */
	@Column(name = "REMARK", length = 100)
	private String remark;

	/**
	 * 审批人
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "EMPLOYEE_ID")
	private HmEmployeeDomain approvalMan;

	/**
	 * 审批时间，yyyy-MM-dd
	 */
	@Temporal(TemporalType.DATE)
	@Column(name = "APPROVAL_TIME")
	private Date approvalTime;

	/**
	 * 处理情况 0未处理，1已处理
	 */
	@Column(name = "HANDLE_YN", nullable = false, length = 1)
	private String handleYn;

	/**
	 * 是否流程的当前审批节点 0否 1是
	 */
	@Column(name = "CURRENT_NODE_YN", nullable = false, length = 1)
	private String currentNodeYn;

	/**
	 * 系统信息
	 */
	@Embedded
	@AttributeOverride(name="sysDate",column=@Column(name="SYS_DATE"))
	private SysInfo sysInfo;

	/**
	 * @roseuid 49473A9D0251
	 */
	public AbstractApprovalDO() {

	}

	public AbstractApprovalDO(Long keyword) {
		super();
		this.keyword = keyword;
	}

	public HmEmployeeDomain getApprovalMan() {
		return approvalMan;
	}

	public void setApprovalMan(HmEmployeeDomain approvalMan) {
		this.approvalMan = approvalMan;
	}

	public Date getApprovalTime() {
		return approvalTime;
	}

	public void setApprovalTime(Date approvalTime) {
		this.approvalTime = approvalTime;
	}

	public String getCurrentNodeYn() {
		return currentNodeYn;
	}

	public void setCurrentNodeYn(String currentNodeYn) {
		this.currentNodeYn = currentNodeYn;
	}

	public String getHandleYn() {
		return handleYn;
	}

	public void setHandleYn(String handleYn) {
		this.handleYn = handleYn;
	}

	public Long getKeyword() {
		return keyword;
	}

	public void setKeyword(Long keyword) {
		this.keyword = keyword;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public SysInfo getSysInfo() {
		return sysInfo;
	}

	public void setSysInfo(SysInfo sysInfo) {
		this.sysInfo = sysInfo;
	}

	/**
	 * 是否通过
	 *
	 * @return boolean
	 * @roseuid 493DDCF201C5
	 */
	public boolean isPass() {
		String result = getResult();
		if("001".equals(result))
			return true;
		return false;
	}

	/**
	 * 是否已处理完
	 *
	 * @return boolean
	 * @roseuid 493DDF07005D
	 */
	public boolean isHandleFinish() {
		String result = getHandleYn();
		if("1".equals(result))
			return true;
		return false;
	}
}
